package com.example.wyt.recycleviewtest

import android.support.v7.app.AppCompatActivity
import android.os.Bundle
import android.support.v7.widget.LinearLayoutManager
import android.support.v7.widget.RecyclerView
import android.widget.LinearLayout
import com.example.wyt.recycleviewtest.Adapter.PeopleListAdapter
import com.example.wyt.recycleviewtest.entity.PeopleEntity

class MainActivity : AppCompatActivity() {
    var vwPeopleList: RecyclerView? = null

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        initView()
    }

    private fun initView() {
        vwPeopleList = findViewById(R.id.vw_recycle)
        val layoutManager = LinearLayoutManager(this)
        layoutManager.orientation = LinearLayout.VERTICAL
        vwPeopleList!!.layoutManager = layoutManager
        val adapter = PeopleListAdapter(this,PeopleEntity.getPeopleEntities())
        vwPeopleList!!.adapter = adapter
    }
}
